<?php


header("Content-type: text/html; charset=utf-8") ;

if($_POST){

	$num1 = $_POST['num1'];
	$num2 = $_POST['num2'];
	$yusuan = $_POST['yusuan'];

	$res;

	switch ($yusuan) {
		case '+':
			$res = $num1+$num2;
			break;
		case '-':
			$res = $num1-$num2;
			break;
		case '*':
			$res = $num1*$num2;
			break;
		case '/':
			$res = $num1/$num2;
			break;
		
		default:
			$res = '';
			break;
	}

	
}


?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>计算器</title>
	<style type="text/css">
		input{
			width: 100px;
		}
		form{
			float: left;
		}
		span{
			float: left;
		}
	</style>
</head>
<body>
	<form action="" method="post">
		<input type="text" name="num1">
		<select name="yusuan" id="">
			<option value="+">+</option>
			<option value="-">-</option>
			<option value="*">*</option>
			<option value="/">/</option>
		</select>
		<input type="text" name="num2">
		<input type="submit" value="计算">
	</form>

	<span>结果：<?php echo isset($res) ? $res : ''; ?> </span>
	
</body>
</html>